package com.project.core.config;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.methods.SelectById;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.github.yulichang.injector.MPJSqlInjector;
import org.noear.solon.annotation.Component;

import java.util.List;
// 这里如果不生效，是solon2.8的问题，处理方式如下，别乱搜
// 详见 https://gitee.com/best_handsome/mybatis-plus-join/issues/I9RN5N#note_27856765
@Component
public class MyLogicSqlInjector extends MPJSqlInjector {

    /**
     * 如果只需增加方法，保留MP自带方法
     * 可以super.getMethodList() 再add
     */
    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
        List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
        methodList.add(new SelectById());
        return methodList;
    }
}
